import { Link } from 'react-router-dom'
import './NewsItem.less'
import { Image } from 'antd-mobile'

const NewsItem = (props) => {
    const { info } = props
    if(!info) return null; 
    const { id, title, hint, images, image } = info
    if(!images)  images=[image]
    if(!Array.isArray(images))  images = ['']
    return <div className='news-item-box'>
    <Link to={{pathname:`/detail/${id}`}}>
    <div className='content'>
       <h4 className='title'>{title}</h4>
       {hint ? <p className='author'>{hint}</p>:null}
       </div>
       <div className='pic' ><Image src={images[0]} lazy/></div>
    </Link>
   </div>

};




export default NewsItem
